var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, i) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var i in t)
              Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
          })(t, i);
      };
      return function (t, i) {
        function o() {
          this.constructor = t;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        e(t, i),
          (t.prototype =
            null === i
              ? Object.create(i)
              : ((o.prototype = i.prototype), new o()));
      };
    })(),
  ForgeEquipmentView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.list_equip_forge.vScrollBarSkin = ""),
        (t.list_equip_forge.selectEnable = !0),
        t.list_equip_forge.on(
          Laya.Event.CLICK,
          t,
          t.onDidClickListEquipForgeAction
        ),
        (t.list_equip_forge.renderHandler = new Laya.Handler(
          t,
          t.updateEquipForgeView
        )),
        t.tab_equip_forge.on(
          Laya.Event.CLICK,
          t,
          t.onDidClickTabEquipForgeAction
        ),
        WebSocketService.addListener({
          caller: t,
          code: 5286,
          method: t.onLoadForgeEquipmentData,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 5287,
          method: t.onLoadStartForgeData,
        }),
        t.btn_forge_shuoming.on(
          Laya.Event.CLICK,
          t,
          t.onDidClickForgeShuoMingAction
        ),
        t.btn_forge_start.on(
          Laya.Event.CLICK,
          t,
          t.onForgeStartEquipmentAction
        ),
        t.btn_equip_close.on(Laya.Event.CLICK, t, t.onForgeEquipmentClose),
        t
      );
    }
    return (
      __extends(t, e),
      (t.openForgeEquipmentView = function (e) {
        return (
          null == this.forgeEquipVC && (this.forgeEquipVC = new t()),
          (this.forgeEquipVC.type = e),
          this.forgeEquipVC.initData(),
          this.forgeEquipVC
        );
      }),
      (t.prototype.initData = function () {
        (this.msgNum = "0"),
          (this.label_mypage_num.text = ""),
          (this.tab_equip_forge.selectedIndex = 0),
          (this.list_equip_forge.visible = !1),
          WebSocketService.send({ c: 5286, d: { type: 1 } });
      }),
      (t.prototype.updateEquipForgeView = function (e, t) {
        if (!(t > this.dataSource.length)) {
          var i = e.dataSource,
            o = e.getChildByName("equip_main"),
            r = e.getChildByName("equip_main_1"),
            n = e.getChildByName("equip_main_2"),
            a = e.getChildByName("btn_xingyunfu");
          i.isXingYunFuSelect
            ? (a.skin = "comp/Home/btn_icon_select.png")
            : (a.skin = "comp/Home/btn_icon_noselect.png"),
            i.isSelect
              ? ((o.borderColor = "#755930"),
                (r.borderColor = "#755930"),
                (n.borderColor = "#755930"))
              : ((o.borderColor = "#755930"),
                (o.borderColor = "#755930"),
                (r.borderColor = ""),
                (n.borderColor = ""));
        }
      }),
      (t.prototype.onDidClickListEquipForgeAction = function (e) {
        if ("" != e.target.name) {
          console.log(e.target.name);
          var t = this.list_equip_forge.selectedItem;
          "btn_xingyunfu" == e.target.name
            ? (this.lastXingYunFuItem &&
              this.lastXingYunFuItem.id == t.id &&
              1 == t.isXingYunFuSelect
                ? (this.lastXingYunFuItem.isXingYunFuSelect = !1)
                : (t.isXingYunFuSelect = !0),
              (this.lastXingYunFuItem = t))
            : (this.lastCellItem && (this.lastCellItem.isSelect = !1),
              (t.isSelect = !0),
              (this.lastCellItem = t)),
            this.list_equip_forge.refresh();
        }
      }),
      (t.prototype.onDidClickTabEquipForgeAction = function (e) {
        var t = this.tab_equip_forge.selectedIndex;
        0 == t
          ? WebSocketService.send({ c: 5286, d: { type: 1 } })
          : 1 == t
          ? WebSocketService.send({ c: 5286, d: { type: 2 } })
          : 2 == t && WebSocketService.send({ c: 5286, d: { type: 3 } });
      }),
      (t.prototype.onLoadForgeEquipmentData = function (e) {
        this.listArr = e.data;
        var t;
        (this.dataSource = []), (this.list_equip_forge.visible = !0);
        for (var i = 0; i < this.listArr.length; i++) {
          var o = this.listArr[i];
          (t = {
            equip_name: { text: o.name },
            equip_prop: { text: "(" + o.spe_msg + ")" },
            equip_property: { text: this.dealBackEqupProperty(o) },
            id: o.id,
            isXingYunFuSelect: !1,
            isSelect: !1,
          }),
            this.dataSource.push(t);
        }
        0 == this.tab_equip_forge.selectedIndex
          ? (this.label_mypage_num.text = "10级铁矿" + e.msg + "个")
          : 1 == this.tab_equip_forge.selectedIndex
          ? (this.label_mypage_num.text = "10级银矿" + e.msg + "个")
          : 2 == this.tab_equip_forge.selectedIndex &&
            (this.label_mypage_num.text = "10级金矿" + e.msg + "个"),
          (this.list_equip_forge.dataSource = this.dataSource);
      }),
      (t.prototype.dealBackEqupProperty = function (e) {
        var t = "";
        return (
          e.ap && e.ap > 0 && (t = "攻击力 +" + e.ap),
          e.df && e.df > 0 && (t = "防御 +" + e.df),
          e.sp && e.sp > 0 && (t = "速度 +" + e.sp),
          e.hp && e.hp > 0 && (t = "气血 +" + e.hp),
          e.mp && e.mp > 0 && (t = "精力 +" + e.mp),
          e.a_qx && e.a_qx > 0 && (t = t + "体质 +" + e.a_qx),
          e.a_jl && e.a_jl > 0 && (t = t + "智力 +" + e.a_jl),
          e.a_ll && e.a_ll > 0 && (t = t + "力量 +" + e.a_ll),
          e.a_mj && e.a_mj > 0 && (t = t + "敏捷 +" + e.a_mj),
          e.r_mz && e.r_mz > 0 && (t = t + "命中 +" + e.r_mz),
          e.r_bj && e.r_bj > 0 && (t = t + "暴击 +" + e.r_bj),
          e.r_fj && e.r_fj > 0 && (t = t + "反击 +" + e.r_fj),
          e.r_zm && e.r_zm > 0 && (t = t + "致命 +" + e.r_zm),
          e.r_mf && e.r_mf > 0 && (t = t + "法爆 +" + e.r_mf),
          e.r_mf && e.r_mf > 0 && (t = t + "法爆 +" + e.r_mf),
          e.r_fz && e.r_fz > 0 && (t = t + "反震 +" + e.r_fz),
          e.r_hb && e.r_hb > 0 && (t = t + "躲避 +" + e.r_hb),
          e.k_wl && e.k_wl > 0 && (t = t + "抗物 +" + e.k_wl),
          e.k_xi && e.k_xi > 0 && (t = t + "抗玄 +" + e.k_xi),
          e.k_feng && e.k_feng > 0 && (t = t + "抗封 +" + e.k_feng),
          e.k_luan && e.k_luan > 0 && (t = t + "抗乱 +" + e.k_luan),
          e.k_wei && e.k_wei > 0 && (t = t + "抗围 +" + e.k_wei),
          e.k_fa && e.k_fa > 0 && (t = t + "抗风 +" + e.k_fa),
          e.k_yao && e.k_yao > 0 && (t = t + "抗火 +" + e.k_yao),
          e.k_du && e.k_du > 0 && (t = t + "抗毒 +" + e.k_du),
          e.k_ll && e.k_ll > 0 && (t = t + "抗雷 +" + e.k_ll),
          t
        );
      }),
      (t.prototype.onDidClickForgeShuoMingAction = function () {
        var e = CaslnoRulesView.showCaslRuleView("forgeshuoming");
        (e.y = 0), (e.height = 667), Laya.stage.addChild(e);
      }),
      (t.prototype.onForgeStartEquipmentAction = function () {
        var e = this.list_equip_forge.selectedItem,
          t = 0;
        if (
          (0 == this.tab_equip_forge.selectedIndex
            ? (t = 1)
            : 1 == this.tab_equip_forge.selectedIndex
            ? (t = 2)
            : 2 == this.tab_equip_forge.selectedIndex && (t = 3),
          e)
        ) {
          var i = 0;
          this.lastXingYunFuItem &&
            e.id == this.lastXingYunFuItem.id &&
            e.isXingYunFuSelect &&
            (i = 1),
            WebSocketService.send({
              c: 5287,
              d: { type: t, lucky: i, armingId: e.id },
            });
        } else
          WebSocketService.send({
            c: 5287,
            d: { type: t, lucky: 0, armingId: "" },
          });
      }),
      (t.prototype.onLoadStartForgeData = function (e) {
        ToastView.toastView(e.msg);
        var t = this.tab_equip_forge.selectedIndex;
        0 == t
          ? WebSocketService.send({ c: 5286, d: { type: 1 } })
          : 1 == t
          ? WebSocketService.send({ c: 5286, d: { type: 2 } })
          : 2 == t && WebSocketService.send({ c: 5286, d: { type: 3 } });
      }),
      (t.prototype.onForgeEquipmentClose = function () {
        this.removeSelf();
      }),
      t
    );
  })(ui.CompoundController.ForgeEquipmentViewUI);
